package com.example.dto;

import com.example.model.dto.BaseDTO;
import com.example.validator.group.AddGroup;
import com.example.validator.group.DefaultGroup;
import com.example.validator.group.UpdateGroup;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Null;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

/**
 * 数据源管理DTO
 */
@Data
@Schema(description = "数据源管理DTO")
public class GenDatasourceDTO extends BaseDTO implements Serializable {
    private static final long serialVersionUID = 1L;

    @Null(message = "{id.null}", groups = AddGroup.class)
    @NotNull(message = "{id.require}", groups = UpdateGroup.class)
    @Schema(description = "id")
    private Long id;

    @Schema(description = "数据库类型 MySQL、Oracle、SQLServer、PostgreSQL")
    private String dbType;

    @Schema(description = "连接名")
    @NotBlank(message = "{datasource.conn_name.require}", groups = DefaultGroup.class)
    private String connName;

    @Schema(description = "URL")
    private String connUrl;

    @Schema(description = "用户名")
    private String username;

    @Schema(description = "密码")
    private String password;

    @Schema(description = "状态  0：启用   1：禁用", example = "0")
    private Integer status;
}